package com.itheima.controller;

import com.itheima.pojo.Result;
import com.itheima.pojo.EmpStatistics;
import com.itheima.pojo.StuStatistics;
import com.itheima.service.StatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 数据统计
 */
@RestController
@RequestMapping("/report")
@Slf4j
public class StatisticsController {
    @Autowired
    private StatisticsService statisticsService;

    @GetMapping("/empGenderData")
    public Result getEmpGenderData() {
        List<Map> list = statisticsService.queryGenderList();
        return Result.success(list);
    }

    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        EmpStatistics empStatistics = statisticsService.queryJobList();
        return Result.success(empStatistics);
    }

    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData(){
        List<Map> list = statisticsService.queryStudentDegreeData();
        return Result.success(list);
    }

    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        StuStatistics stuStatistics = statisticsService.queryStudentCountData();
        return Result.success(stuStatistics);
    }

}
